<?php

declare(strict_types=1);

namespace App\Command\Tests;

use App\Services\Orders\Order;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Psr\Container\ContainerInterface;
use App\Factory\Wechat\Factory;

#[Command]
class TestCommand extends HyperfCommand
{
    public function __construct(
        protected ContainerInterface $container,
        protected Factory $wechatFactory,
        protected Order $orderServices
    )
    {
        parent::__construct('tests:test');
    }

    public function configure()
    {
        parent::configure();
        $this->setDescription('测试命令');
    }

    public function handle()
    {
//        $app = $this->wechatFactory->mini();
//        $response = $app->getClient()->post('/wxa/generate_urllink', [
//            'json' => [
//                'path' => 'pages/index/index'
//            ]
//        ]);
//        logs($response);

        /** @var \App\Model\Orders\Order $orderModel */
        $orderModel = $this->orderServices->where('merchant_no', 'NH202510091209168159')->firstOrFail();
        logs($orderModel->queryPaymentOrder(['pay_code' => 'sandpayMini']));
    }
}
